﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace QueuePractice
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue queue = new Queue();
            queue.Enqueue("祖国大好河山");
            queue.Enqueue(666);
            int[] arr = { 3, 3, 5, 5 };
            //queue.Enqueue(arr);

            queue.Enqueue("啊，真美啊，啊，啊啊");

            //遍历2
            var arr1 = queue.ToArray();

            foreach (var item in arr1)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("==============");

            //遍历3
            var gentor = queue.GetEnumerator();

            while (gentor.MoveNext())
            {
                Console.WriteLine(gentor.Current);
            }
            Console.WriteLine("==============");

            //遍历1
            while (queue.Count != 0)
            {
                var item = queue.Dequeue();//Peek 不出去 只循环第一个
                Console.WriteLine(item);
            }
            Console.WriteLine("==============");

            //买票咯
            queue.Enqueue("赵赵赵");
            queue.Enqueue("钱钱钱");
            queue.Enqueue("孙孙孙");

            Console.WriteLine("快来买");
            while (queue.Count!=0)
            {
                Console.WriteLine(queue.Dequeue()+"已经买好了");
            }
            Console.WriteLine("卖完咯，回家睡觉");


        }
    }
}
